package Level02_three;

import java.util.HashSet;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        HashSet<Object> hashSet = new HashSet<>();
        Student student = new Student("小胡", 22, "男");
        Student student1 = new Student("小程", 21, "男");
        Student student2 = new Student("小向", 20, "男");
        Student student3 = new Student("李四", 19, "男");
        Student student4 = new Student("张三", 18, "男");
        Student student5 = new Student("小胡", 22, "男");
        hashSet.add(student);
        hashSet.add(student1);
        hashSet.add(student2);
        hashSet.add(student3);
        hashSet.add(student4);
        hashSet.add(student5);
        for (Object o : hashSet) {
            System.out.println(o);
        }
        System.out.println("使用迭代器+++++");
        Iterator<Object> iterator = hashSet.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
